package com.jxdinfo.hussar.cloud.module.labor.xgfgl.inoutstat.controller;

import com.jxdinfo.hussar.cloud.module.labor.xgfgl.inoutstat.dto.ListClockDataDTO;
import com.jxdinfo.hussar.cloud.module.labor.xgfgl.inoutstat.dto.PageRelatedInoutstatDTO;
import com.jxdinfo.hussar.cloud.module.labor.xgfgl.inoutstat.service.RelatedInoutstatService;
import com.jxdinfo.hussar.cloud.module.labor.xgfgl.inoutstat.vo.RelatedClockVO;
import com.jxdinfo.hussar.cloud.module.labor.xgfgl.inoutstat.vo.RelatedInoutstatPageVO;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;
import com.jxdinfo.hussar.support.audit.core.annotations.AuditLog;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventGrade;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 相关方人员进出统计controller
 * @author cx
 */
@Api(tags = "相关方人员-进出统计")
@RestController(value = "xgfgl.inoutstat.InoutstatController")
@AuditLog(moduleName = "相关方人员进出统计")
@RequestMapping(value = "/xgfgl/inoutstat")
public class RelatedInoutstatController {

    private static final Logger logger = LoggerFactory.getLogger(RelatedInoutstatController.class);

    @Autowired
    private RelatedInoutstatService relatedInoutstatService;

    /**
     * 相关方人员进出统计列表(分页查询)
     * @param dto
     * @return
     */
    @ApiOperation(value = "相关方人员进出统计列表(分页查询)")
    @AuditLog(moduleName = "相关方人员进出统计", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("pageRelatedInoutstat")
    public ApiResponse<RelatedInoutstatPageVO> pageRelatedInoutstat(@RequestBody @Validated PageRelatedInoutstatDTO dto){
        RelatedInoutstatPageVO relatedInoutstatPageVO = relatedInoutstatService.pageRelatedInoutstat(dto);
        return ApiResponse.success(relatedInoutstatPageVO);
    }

    /**
     * 查询相关方人员的打卡记录数据
     * @param dto
     * @return
     */
    @ApiOperation(value = "查询相关方人员的打卡记录数据")
    @AuditLog(moduleName = "相关方人员进出统计", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("listClockData")
    public ApiResponse<List<RelatedClockVO>> listClockData(@RequestBody @Validated ListClockDataDTO dto){
        List<RelatedClockVO> clockVOList = relatedInoutstatService.listClockData(dto);
        return ApiResponse.success(clockVOList);
    }







}
